<html>
<head><meta charset="utf-8"><title>support for fn-like proc macros · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html">support for fn-like proc macros</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="217647851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217647851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217647851">(Nov 23 2020 at 16:11)</a>:</h4>
<p>Hi, I am interested in tackling <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5265">https://github.com/rust-analyzer/rust-analyzer/issues/5265</a>. Would someone who is familiar with the current state of proc macro support be willing to give some tips on what needs to change and where to get started? Thank you! :)</p>



<a name="217770627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217770627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217770627">(Nov 24 2020 at 15:41)</a>:</h4>
<p>It seems to me that something like that would only be possible if the proc macro "cooperates" and propagates the input identifiers instead of creating new ones. That way we can at least theoretically map between input and output tokens via <code>mbe::TokenMap</code>.</p>
<p>I don't know if this actually works correctly with proc macros though.</p>



<a name="217771079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217771079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217771079">(Nov 24 2020 at 15:44)</a>:</h4>
<p>do we expand fn-like proc macros? I'm confused what the actual problem is now, is it expanding them or making IDE features work inside of them? If it's the latter, and we're expanding them already, Jonas is right. But the macros <em>should</em> already be doing that, if they want correct error spans in rustc, right? In that case the question does become whether we're tracking that correctly all the way through</p>



<a name="217771213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217771213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217771213">(Nov 24 2020 at 15:45)</a>:</h4>
<p>Yeah we should be expanding them now (not <em>correctly</em>, mind you, but simple cases should work)</p>



<a name="217771346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217771346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217771346">(Nov 24 2020 at 15:46)</a>:</h4>
<p>(renamed the issue to clarify what is being requested)</p>



<a name="217771457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217771457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217771457">(Nov 24 2020 at 15:47)</a>:</h4>
<p>I have to admit I don't really know in detail how span tracking works in proc macros, don't they nowadays usually stringify and re-parse their input? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="217771495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217771495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217771495">(Nov 24 2020 at 15:47)</a>:</h4>
<p>or is that not the case anymore</p>



<a name="217771631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217771631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217771631">(Nov 24 2020 at 15:48)</a>:</h4>
<p>I'm not sure either, syn might consume the tokens from the <code>TokenStream</code> directly</p>



<a name="217775127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217775127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217775127">(Nov 24 2020 at 16:10)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> <span class="user-mention" data-user-id="129457">@Florian Diebold</span> Using the <code>syn</code> and <code>quote</code> crates it is straightforward to propagate the input identifiers, and blocks wrapped in curly braces are passed through verbatim.</p>



<a name="217775740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217775740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217775740">(Nov 24 2020 at 16:13)</a>:</h4>
<p>I am already observing some rudimentary support for fn-like proc macros in rust analyzer: the type of the return value is available on hover, even when there is no type annotation nearby that could be hinting it.</p>



<a name="217775866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217775866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217775866">(Nov 24 2020 at 16:14)</a>:</h4>
<p>yeah, that's what you'd expect when we can expand the macro, but not track the tokens through the expansion</p>



<a name="217775993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217775993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217775993">(Nov 24 2020 at 16:14)</a>:</h4>
<p>for IDE features to work <em>inside</em> the macro call, we need to know the connection between the tokens written in the source code, and the tokens in the expanded code. And that probably doesn't work right now</p>



<a name="217776204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776204">(Nov 24 2020 at 16:16)</a>:</h4>
<p>that makes sense</p>



<a name="217776271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776271">(Nov 24 2020 at 16:16)</a>:</h4>
<p>I am observing that the rust compiler is keeping track of that correctly. Red squiggles end up in the right places when there are errors.</p>



<a name="217776306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776306">(Nov 24 2020 at 16:17)</a>:</h4>
<p>that's good in the sense that it should at least be possible to do, then ;)</p>



<a name="217776375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776375">(Nov 24 2020 at 16:17)</a>:</h4>
<p>can you provide any guidance on where in the rust analyzer I could start digging to add this support?</p>



<a name="217776514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776514">(Nov 24 2020 at 16:18)</a>:</h4>
<p>we also already do it for macro_rules macros, so the infrastructure exists already. So the missing piece should "just" be to keep track in the proc-macro specific parts</p>



<a name="217776767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776767">(Nov 24 2020 at 16:20)</a>:</h4>
<p>One thing that isn't going to work is IDE support in incomplete proc macro input. The macro has to expand successfully or we don't get any output from it.</p>



<a name="217776793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776793">(Nov 24 2020 at 16:20)</a>:</h4>
<p>ah, that's true :(</p>



<a name="217776906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217776906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217776906">(Nov 24 2020 at 16:21)</a>:</h4>
<p>ya, but at least getting it working for when the macro expands successfully would be a big step.</p>



<a name="217777088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777088">(Nov 24 2020 at 16:22)</a>:</h4>
<p>what if the macro was designed to be fault-tolerant, i.e. it expanded to produce partial rust code?</p>



<a name="217777453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777453">(Nov 24 2020 at 16:24)</a>:</h4>
<p>then it should work, but it's doubtful that many proc macros are.</p>



<a name="217777499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777499">(Nov 24 2020 at 16:25)</a>:</h4>
<p>syn would have to be able to parse incomplete code too</p>



<a name="217777707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777707">(Nov 24 2020 at 16:26)</a>:</h4>
<p>Thanks, I'm going to start looking into this and will let you know how it goes.</p>



<a name="217777715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777715">(Nov 24 2020 at 16:26)</a>:</h4>
<p>I can't tell you exactly what to do, but I'd start around <a href="https://github.com/rust-analyzer/rust-analyzer/blob/b769f5da6e51d1da2c981f00c48fb2585f933138/crates/proc_macro_api/src/process.rs#L61-L66">here</a>. This function gets a <code>Subtree</code> and returns an expanded <code>Subtree</code>. The tokens in this subtree have <code>TokenId</code>s, and those need to be preserved. <span class="user-mention" data-user-id="211727">@Jonas Schievink</span> am I missing something, or do fn-like proc macros also expand through <code>custom_derive</code>?</p>



<a name="217777746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777746">(Nov 24 2020 at 16:27)</a>:</h4>
<p>yes, it's a gross hack :D</p>



<a name="217777796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777796">(Nov 24 2020 at 16:27)</a>:</h4>
<p>you can use custom derives as <code>!</code>-macros and vice-versa</p>



<a name="217777938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/217777938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#217777938">(Nov 24 2020 at 16:28)</a>:</h4>
<p>thanks :)</p>



<a name="219144450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219144450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219144450">(Dec 07 2020 at 22:00)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> it seems that the changes you made in the last few days to proc-macros have to some extent implemented this feature!</p>



<a name="219144516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219144516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219144516">(Dec 07 2020 at 22:00)</a>:</h4>
<p>uh, yeah, this seems to work wayyyy better than expected</p>



<a name="219144534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219144534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219144534">(Dec 07 2020 at 22:00)</a>:</h4>
<p>I wonder if it was the token remapping fix that did this</p>



<a name="219144571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219144571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219144571">(Dec 07 2020 at 22:01)</a>:</h4>
<p>They now basically work as well as MBE macros, at least in the cases I've tested</p>



<a name="219144768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219144768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219144768">(Dec 07 2020 at 22:02)</a>:</h4>
<p>thanks! :) I am testing now and so far a lot is working.</p>



<a name="219145074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219145074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219145074">(Dec 07 2020 at 22:05)</a>:</h4>
<p>I am seeing a lot of "proc macro server crashed" errors, I will try to get something small and reproducible and file an issue.</p>



<a name="219145167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219145167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219145167">(Dec 07 2020 at 22:06)</a>:</h4>
<p>Is there a way of rebooting the proc macro server without restarting RA?</p>



<a name="219145192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219145192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219145192">(Dec 07 2020 at 22:06)</a>:</h4>
<p>Not currently, no</p>



<a name="219145223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219145223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219145223">(Dec 07 2020 at 22:06)</a>:</h4>
<p>But it prints the panic message to stderr</p>



<a name="219145239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219145239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219145239">(Dec 07 2020 at 22:06)</a>:</h4>
<p>So it should show up in the output panel</p>



<a name="219206521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219206521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219206521">(Dec 08 2020 at 13:34)</a>:</h4>
<p>I think we could send a <code>window/showMessageRequest</code> to the client and prompt a restart if someone wanted to implement that</p>



<a name="219206911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/support%20for%20fn-like%20proc%20macros/near/219206911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/support.20for.20fn-like.20proc.20macros.html#219206911">(Dec 08 2020 at 13:38)</a>:</h4>
<p>Yes, that would be good</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>